package myJs.contact

import myJs.MainCp
import myJs.api.Api
import myJs.cps._
import myJs.myPkg.bootstrap.jquery.{AffixOptions, Offset, ScrollspyOptions}
import myJs.myPkg.jquery.$
import org.scalajs.dom.document
import slinky.core.annotations.react
import slinky.core.facade.Hooks._
import slinky.core.{FunctionalComponent, TagElement}
import slinky.web.SyntheticMouseEvent
import slinky.web.html._
import typings.csstype.csstypeStrings
//import myJs.myPkg.i18n.ReactI18next
import myJs.Implicits._

/**
 * Created by yz on 21/1/2022
 */
@react object Cp {

  case class Props(showLoading: Boolean = true)

  val curPage = Contact

  val component = FunctionalComponent[Props] { props =>

    object FTool {

      def scrollExec(anchorName: String) = {
        document.getElementById(anchorName).scrollIntoView()
      }

      def scrollToAnchor(anchorName: String) = (e: SyntheticMouseEvent[TagElement#RefType]) => {
        e.preventDefault()
        scrollExec(anchorName)
      }

    }

    useEffect(() => {
      $("body").scrollspy(ScrollspyOptions(target = "#myScrollspy", offset = 1))
      $("#myNav").affix(AffixOptions(offset = Offset(top = 50)))
    }, List()
    )

    val liWidth = 280

    MainCp(title = curPage.titleStr)(

      div(

        div(className := "panel panel-default",
          div(className := "panel-heading",
            h3(className := "panel-title",
              s"${curPage.titleStr}"
            )
          ),
        ),

        div(className := "panel panel-default",
          div(style := Style(backgroundColor = "RGB(218,227,243)", backgroundImage = "none",
            borderColor = "RGB(218,227,243)"), className := "panel-heading",
            h4(style:=Style(fontSize = 16),className := "bold",
              "Contact Information"
            )
          ),
          div(className := "panel-body",
            p(style := Style(fontSize = "14px", fontWeight = csstypeStrings.bold, lineHeight = "25px"), className := "text-justify",
              "Huang Lab, Contact @ Dr. Huang: ",
              a(href := "mailto:slhuang@fudan.edu.cn", "slhuang@fudan.edu.cn"),
              br(),
              "Fudan University Shanghai Cancer Center & Institutes of Biomedical Sciences",
              br(),
              "Shanghai Medical College, Fudan University",
              br(),
              "270 Dong An Rd., Shanghai 200032, CHINA"
            ),

          )
        )

      )

    )

  }

  object STool {


  }

}
